package cn.fuego.busrental.ui.Frament;


import java.util.ArrayList;
import java.util.List;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import cn.fuego.busrental.R;
import cn.fuego.busrental.ui.user.BasicDataActivity;
import cn.fuego.busrental.ui.user.MessageListActivity;
import cn.fuego.busrental.ui.user.MyOrderActivity;
import cn.fuego.busrental.ui.user.SystemSetActivity;
import cn.fuego.misp.ui.list.MispListFragment;



public class UserFrament extends MispListFragment<Integer> {

	private List<Integer> dateList;
	private Button img;
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View view=super.onCreateView(inflater, container, savedInstanceState);
		img=(Button)view.findViewById(R.id.user_img);
		dateList=new ArrayList<Integer>();
		dateList.add(1);
		dateList.add(2);
		dateList.add(3);
	
		this.refreshList(dateList);
		return view;
	}

	@Override
	public void initRes() {
		this.fragmentRes.setImage(R.drawable.tab_icon_user);
		this.fragmentRes.setFragmentView(R.layout.frament_user);
		this.fragmentRes.setName(R.string.frament_user);
		this.listViewRes.setListItemView(R.layout.item_user_list);
        this.listViewRes.setListView(R.id.user_list);
        this.fragmentRes.getButtonIDList().add(R.id.user_img);
		
	}
	

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.user_img:
			BasicDataActivity.jump(getActivity());
			break;

		default:
			break;
		}
	}

	@Override
	public View getListItemView(View view, Integer item) {
		
		ImageView img=(ImageView) view.findViewById(R.id.user_list_image_icon);
		TextView t=(TextView) view.findViewById(R.id.user_list_itemname);
		if(item==1)
		{
			t.setText("我的消息");
		}
		if(item==2)
		{
			img.setImageResource(R.drawable.my_order);
			t.setText("我的订单");
		}
		if(item==3)
		{
			img.setImageResource(R.drawable.my_set);
			t.setText("系统设置");
		}
		return view;
	}

	@Override
	public void onItemListClick(AdapterView<?> parent, View view, long id,
			Integer item) {
		if(item==1)
		{
			MessageListActivity.jump(getActivity());
		}
		if(item==2)
		{
			MyOrderActivity.jump(getActivity());
		}
		if(item==3)
		{
			SystemSetActivity.jump(getActivity());
		}
	}

	@Override
	public void loadSendList() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public List loadListRecv(Object obj) {
		// TODO Auto-generated method stub
		return null;
	}


}
